package main

import (
	"fmt"
	"rolling-number-demo/rolling"
	"time"
)

func main() {
	numberRolling := rolling.NewNumber(100*time.Millisecond, 10*time.Second)
	times := 0
	start := time.Now()
	c := time.Tick(10 * time.Millisecond)
	for range c {
		numberRolling.Increment(1)
		times++
		if times > 1000 {
			break
		}
	}
	duration := time.Since(start)
	fmt.Println(duration)
	fmt.Println(numberRolling.Sum())
	fmt.Println(numberRolling.SumLastSecond())
}
